<template>
    <div class="completescreening">
     
        <img class="completescreeningbg" @touchstart="onTouchStart" @touchend="onTouchEnd" src="https://anxd2.oss-cn-shanghai.aliyuncs.com/redPacket/img/筛查完成弹窗.png" alt="">
        <div class="completescreeningbtn" @click="goresult" >
            <img class="completescreeningbtnimg" src="@/assets/images/home/筛查完成弹窗-按钮.png" alt="">
        </div>
    </div>
</template>
<script>
import { getredpacket } from '@/api/http.js'
export default{
    props: ['goclose'],
    data() {
        return {
            addEnterpriseWechatFlag:'',
        }
    },
    mounted() {
        getredpacket().then(res => {
			console.log('===res===', res);
			this.addEnterpriseWechatFlag = res.data.addEnterpriseWechatFlag
		})
    },
    methods:{
        goresult(){
            this.$router.push('/result')
        },
        onTouchStart() {
			this.timer = setTimeout(() => {
				// 长按事件开始后要执行的代码
				console.log("长按事件开始");
				if (this.addEnterpriseWechatFlag == '0') {
					this.$router.push('/Jointrainingcamp')
				} else {
					console.log('已领取');
				}
			}, 1500); // 设置长按事件的延时时间
		},
		onTouchEnd() {
			clearTimeout(this.timer); // 清除计时器，避免误触发长按事件
			// 长按事件结束后要执行的代码
			console.log("长按事件结束");
		},
    }
}
</script>

<style>
.completescreening{
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    z-index: 89;
    background: #000000bf;
}

.completescreeningbg{
    width: 100%;
    height: 546px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.completescreeningbtn{
    width: 100%;
    height: 46px;
    position: absolute;
    top: 76%;
}
.completescreeningbtnimg{
    width: 100%;
    height: 100%;
}
</style>
